#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
const int N = 55;
int f[N][N];
string s1, s2;
int main()
{
	getline(cin, s1);
	getline(cin, s2);
	s1 = " " + s1;
	s2 = " " + s2;
	int n = s1.size();
	int m = s2.size();
	int ma = 0;
	for (int i = 1; i <= n - 1; i++) {
		for (int j = 1; j <= m - 1; j++) {
			if (s1[i] == s2[j]) f[i][j] = f[i - 1][j - 1] + 1;
			ma = max(ma, f[i][j]);
		}
	}
	cout << ma << endl;
	return 0;
}